import request from '@/utils/request'

const api = {
    // 根据ID获取抽样方案
    getInfo(id)
    {
        return request({
            url: `/api/BaseData/Samplingplan/${id}`,
            method: 'get'
        });
    },
    // 获取所有启用的抽样方案
    getAll()
    {
        return request({
            url: `/api/BaseData/Samplingplan/All`,
            method: 'GET'
        });
    },
    // 查询缺陷抽样方案
    getList(query)
    {
        return request({
            url: `/api/BaseData/Samplingplan`,
            method: 'get',
            data: query
        });
    },
    // 创建抽样方案
    create(dataForm)
    {
        return request({
            url: `/api/BaseData/Samplingplan`,
            method: 'post',
            data: dataForm,
        });
    },
    // 更新抽样方案
    update(id,dataForm)
    {
        return request({
            url: `/api/BaseData/Samplingplan/${id}`,
            method: 'put',
            data: dataForm,
        });
    },
    // 删除抽样方案
    delete(id)
    {
        return request({
            url: `/api/BaseData/Samplingplan/${id}`,
            method: 'delete',
        });
    },
    // 根据ID批量删除抽样方案
    batchDelete(ids)
    {
        return request({
            url: `/api/BaseData/Samplingplan/batchRemove`,
            method: 'POST',
            data: ids,
        });
    },
    // 根据查询条件导出数据
    export(query)
    {
        return request({
            url: `/api/BaseData/Samplingplan/Actions/Export`,
            method: 'get',
            data: query
        });
    },
    // 导入
    ImportData(data)
    {
        return request({
            url: '/api/BaseData/Samplingplan/ImportData',
            method: 'post',
            data
        });
    },
    // 导入预览
    ImportPreview(data)
    {
        return request({
            url: '/api/BaseData/Samplingplan/ImportPreview',
            method: 'get',
            data
        });
    },
    // 模板下载
    TemplateDownload()
    {
        return request({
            url: '/api/BaseData/Samplingplan/TemplateDownload',
            method: 'get'
        });
    }
};

export default api;

export const getSamplingPlanAll = api.getAll;
